<!--<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<title>车协官网后台管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">

		<link rel="stylesheet" href="/admin/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="/admin/css/global.css" media="all">
		<link rel="stylesheet" href="/admin/plugins/font-awesome/css/font-awesome.min.css">

	</head>

	<body>
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header header header-demo">
				<div class="layui-main">
					<div class="admin-login-box">
						<a class="logo" style="left: 0;" href="http://beginner.zhengjinfan.cn/demo/beginner_admin/">
							<span style="font-size: 22px;">后台管理</span>
						</a>
						<div class="admin-side-toggle">
							<i class="fa fa-bars" aria-hidden="true"></i>
						</div>
					</div>
					<ul class="layui-nav admin-header-item">
						<li class="layui-nav-item">
							<span>欢迎您<%=host%>:</span>
						</li>
						<li class="layui-nav-item">
							<a href="/" target="_blank">浏览网站</a>
						</li>
						<li class="layui-nav-item" >
							<a href="/logout"><i class="fa fa-sign-out"></i> 注销</a>
						</li>

					</ul>

				</div>
			</div>
			<div class="layui-side layui-bg-black" id="admin-side">
				<div class="layui-side-scroll" id="admin-navbar-side" lay-filter="side"></div>
			</div>
			<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;" id="admin-body">
				<div class="layui-tab admin-nav-card layui-tab-brief" lay-filter="admin-tab">
					<ul class="layui-tab-title">
						<li class="layui-this">
							<i class="fa fa-dashboard" aria-hidden="true"></i>
							<cite>主页</cite>
						</li>
					</ul>-->
					<%include common/include_header.html%>
					<div class="layui-tab-content" style="min-height: 150px; padding: 5px 0 0 0;">
						<div>
							<div style="margin: 15px;">
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>编辑企业信息</legend>
		</fieldset>

		<form class="layui-form" action="">
			<div class="layui-form-item">
        <label class="layui-form-label">职位</label>
        <div class="layui-input-block">
          <input type="text" id="position" name="position"  autocomplete="off" placeholder="请输入职位" class="layui-input">
        </div>
      </div>
       
      <div class="layui-form-item">
        <label class="layui-form-label">招聘人数</label>
        <div class="layui-input-block">
          <input type="text" id="population" name="population"  autocomplete="off" placeholder="请输入招聘人数" class="layui-input">
        </div>
      </div>
      
      <div class="layui-form-item">
        <label class="layui-form-label">工作地点</label>
        <div class="layui-input-block">
          <input type="text" id="place" name="place"  autocomplete="off" placeholder="请输入工作地点" class="layui-input">
        </div>
      </div>

      <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
          <input type="radio" name="sex" value="0" title="男" checked="">
          <input type="radio" name="sex" value="1" title="女">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-block">
          <input type="text" id="age" name="age"  autocomplete="off" placeholder="请输入年龄" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">工龄</label>
        <div class="layui-input-block">
          <input type="text" id="seniority" name="seniority"  autocomplete="off" placeholder="请输入工龄" class="layui-input">
        </div>
      </div>
      
      <div class="layui-form-item">
        <label class="layui-form-label">学历</label>
        <div class="layui-input-block">
          <input type="text" id="educational" name="educational"  autocomplete="off" placeholder="请输入学历" class="layui-input">
        </div>
      </div>
      
      <div class="layui-form-item">
        <label class="layui-form-label">语言</label>
        <div class="layui-input-block">
          <input type="text" id="language" name="language"  autocomplete="off" placeholder="请输入要求语言" class="layui-input">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">待遇</label>
        <div class="layui-input-block">
          <input type="text" id="treatment" name="treatment"  autocomplete="off" placeholder="请输入待遇" class="layui-input">
        </div>
      </div>


      <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">详细要求</label>
        <div class="layui-input-block">
          <script id="editor" type="text/plain" style="width:1024px;height:800px;"></script>
          <!--<textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>-->
        </div>
      </div>

      <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" id="add">立即提交</button>
          <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
      </div>
		</form>
	</div>
						</div>
					</div>
				<code id="testcon" style="display:none;"></code>
			<%include common/include_footer.html%>
			<!--<div class="layui-footer footer footer-demo" id="admin-footer">
				<div class="layui-main">
					<p>2018 &copy;
						<a href="/">惠升后台管理系统</a> LGPL license
					</p>
				</div>
			</div>
			<div class="site-tree-mobile layui-hide">
				<i class="layui-icon">&#xe602;</i>
			</div>-->

			<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
			<script type="text/javascript" src="/admin/plugins/layui/layui.js"></script>
			<!--<script type="text/javascript" src="/admin/datas/nav.js"></script>-->
			<script src="/admin/js/index1.js"></script>
			<script>
				layui.use(['form', 'laydate','upload'], function() {
			var form = layui.form(),
					layer = layui.layer,
					laydate = layui.laydate,
					$= layui.jquery;
			var ue = UE.getEditor('editor');
			ue.ready(function() {
			    //设置编辑器的内容
			    ue.execCommand('insertHtml', htmlspecialchars_decode("<%=data.content%>"));
			});
			//给ueditor插入值
  function htmlspecialchars_decode(str){           
              str = str.replace(/&amp;/g, '&'); 
              str = str.replace(/&lt;/g, '<');
              str = str.replace(/&gt;/g, '>');
              str = str.replace(/&quot;/g, "''");  
              str = str.replace(/&#039;/g, "'");  
              str = str.replace(/&#34;/g, '"'); 
              return str;  
    }
      $("#position").val("<%=data.position%>");
			$("#population").val("<%=data.population%>");
			 $("#place").val("<%=data.place%>");
       $("#age").val("<%=data.age%>");
      $("#seniority").val("<%=data.seniority%>");
       $("#educational").val("<%=data.educational%>");
      $("#language").val("<%=data.language%>");
       $("#treatment").val("<%=data.treatment%>");
			var mCategory="<%=data.sex%>";
			switch(mCategory){
				case "0":
				$(".layui-form-radio").eq(0).trigger("click");
				break;
				case "1":$(".layui-form-radio").eq(1).trigger("click");
				break;
				case "2":$(".layui-form-radio").eq(2).trigger("click");break;
				case "3":$(".layui-form-radio").eq(3).trigger("click");break;
			}
			
			//监听提交
			//点击添加分类
			$('#add').on('click', function() {
				var position=$("#position").val();
        var population=$("#population").val();//招聘人数
        var place=$("#place").val();//工作地点
        //获取选中的radio的内容
        var sex=$('input:radio:checked').val();//性别
        
        if(sex==0){
          sex="男"
        }else{
          sex="女"
        }
        var age=$("#age").val();//年龄
        var seniority=$("#seniority").val();//工龄
        var educational=$("#educational").val();//学历
        var language=$("#language").val();//语言
        var treatment=$("#treatment").val();//语言
        //获取多文本编辑内容
        var content=UE.getEditor('editor').getContent();
				//测试用户是否录入信息
				if(position==""||population==""||place==""||language==""||content==""){
          layer.alert('请填入相关信息');
          return false;
        }
				var id="<%=id%>".toString();
				console.log({_id:id,position:position,population:population,place:place,sex:sex,age:age,seniority:seniority,educational:educational,language:language,treatment:treatment,content:content})
				alert(id)
				$.post("/admin/edit_recruit",{_id:id,position:position,population:population,place:place,sex:sex,age:age,seniority:seniority,educational:educational,language:language,treatment:treatment,content:content},function(result){
				  
					if(result.status==="success"){
						layer.alert('修改成功,请在招聘列表查看。', {icon: 1} ,function(){
							location.href="/admin/recruit_list";
						});
						return false;
					}else{
						layer.alert('修改失败', {icon: 2});
						return false;
					}
				});
				//这句话的意思不会刷新当前页面。避免清空内容
				return false;
			});
		});			</script>
		</div>
	</body>

</html>